package com.example.easypad;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

import androidx.annotation.Nullable;

public class ContactSQLiteOpenHelper extends SQLiteOpenHelper {
    private Context mContext;

    public ContactSQLiteOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        mContext = context;
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        //创建User表
        sqLiteDatabase.execSQL(
                "CREATE TABLE User(" +
                        "uid INTEGER PRIMARY KEY AUTOINCREMENT," +
                        "userName VARCHAR(16)," +
                        "passWord VARCHAR(16))"
        );
        //创建Notes表
        sqLiteDatabase.execSQL(
                "CREATE TABLE Notes(" +
                        "id INTEGER PRIMARY KEY AUTOINCREMENT," +
                        "title VARCHAR(16)," +
                        "context TEXT," +
                        "type VARCHAR(16)," +
                        "dateTime VARCHAR(16)," +
                        "userName VARCHAR(16))"
        );



    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
        if (newVersion > oldVersion) {

        }
    }
}
